package com.ruoyi.web.controller.ltd_web;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.ltd_web.domain.LtdNews;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.ltd_web.domain.LtdManage;
import com.ruoyi.ltd_web.service.ILtdManageService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 公司管理人员信息Controller
 *
 * @author ruoyi
 * @date 2024-12-17
 */
@RestController
@RequestMapping("/system/manage")
public class LtdManageController extends BaseController
{
    @Autowired
    private ILtdManageService ltdManageService;

    /**
     * 查询公司管理人员信息列表
     */
    @Anonymous
    @GetMapping("/list")
    public TableDataInfo list(LtdManage ltdManage)
    {
        startPage();
        List<LtdManage> list = ltdManageService.selectLtdManageList(ltdManage);
        return getDataTable(list);
    }

    /**
     * 导出公司管理人员信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:manage:export')")
    @Log(title = "公司管理人员信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, LtdManage ltdManage)
    {
        List<LtdManage> list = ltdManageService.selectLtdManageList(ltdManage);
        ExcelUtil<LtdManage> util = new ExcelUtil<LtdManage>(LtdManage.class);
        util.exportExcel(response, list, "公司管理人员信息数据");
    }

    /**
     * 获取公司管理人员信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:manage:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(ltdManageService.selectLtdManageById(id));
    }

    /**
     * 新增公司管理人员信息
     */
    @PreAuthorize("@ss.hasPermi('system:manage:add')")
    @Log(title = "公司管理人员信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LtdManage ltdManage)
    {
        return toAjax(ltdManageService.insertLtdManage(ltdManage));
    }

    /**
     * 修改公司管理人员信息
     */
    @PreAuthorize("@ss.hasPermi('system:manage:edit')")
    @Log(title = "公司管理人员信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LtdManage ltdManage)
    {
        return toAjax(ltdManageService.updateLtdManage(ltdManage));
    }

    /**
     * 删除公司管理人员信息
     */
    @PreAuthorize("@ss.hasPermi('system:manage:remove')")
    @Log(title = "公司管理人员信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ltdManageService.deleteLtdManageByIds(ids));
    }

    /**
     * 查询公司管理人员信息列表
     */
    @Anonymous
    @GetMapping("/listByType")
    public AjaxResult listByType(LtdManage ltdManage) {
        return AjaxResult.success(ltdManageService.selectLtdManageList(ltdManage));
    }

    /**
     * 状态修改
     */
    @PreAuthorize("@ss.hasPermi('system:manage:edit')")
    @Log(title = "公司管理--状态修改", businessType = BusinessType.UPDATE)
    @PutMapping("/changeStatus")
    public AjaxResult changeStatus(@RequestBody LtdManage ltdManage)
    {
        return toAjax(ltdManageService.updateLtdManage(ltdManage));
    }
}
